package com.after.saas.common.utils.des;

import com.after.saas.common.utils.EncodeUtil;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import lombok.extern.slf4j.Slf4j;

/**
 * Hello world!
 */
@Slf4j
public class App {
    public static void main(String[] args) {
        log.info("Hello World!");

        String data = "Xe//XCHbHBJIfNlx3AP9uRoKJOoF9SgX+MXlhPB8m/RwYo7+0PArI2yy81TTHuEn7LI6pt54nG1s2H/gvX6mDAOlP91fhalJ+0rWcEEGi7VXhVxTWFYFBc3YG3F7Q7M4";
        String des = "KOYn4eOPrduVDxAFz4tETfK0fPo1vwVcjCPMsJJ2kqu9cfmzVAq5vOraAiW9rue5tmZ7uVrZB+wb6Nl6bsbKu3AowTKzPN+EjSDgQqSjEfzFMO/wOnss0Ifljh21AaW7yPjfbMVXYrEn4JgHPjP1zCMN7TL2EPKazUQglmgd1IQYTS4DzZRjDglWc7l9OXhCfRsIh+WVELo4e1PqOQRDmt4RaWDH878K4qJM7bDrpfvO8cyxLJexLiFhev+jwnuLpKV7fDJlID/OMIQBU3ZbGULZ0sVIWxN9oQs3DCR/xrMazw7/g0diKqiuZCAdA2gNEnl2/JwOP5Pfe7vgtou0PAuu44qrmAyjpxVmsZaJcAm1fNjZZ5G5Uf9tt6CPIkDb2D5FUvt0BST9pXjEpOzxLFdhHjMuSWshuU+JihS7rFyeBY/e4NH9yXRCB2BnGEepe2DQGLvdc4NFGZpZyicEpmlMexytkZ+meldlBwCuSbCbxvkwqSVGxEsXututQGph1ndbMlrVl73QWS+e1RDmUJ8AXx2SNb09o/ILb7FAgsCSdBXxx/mJr7hnT1Qp4lexfiOYWIjMYsh68odiLhVkIITUIksbgnzU";
        EncryptDESCBC encrypt = new EncryptDESCBC();

        log.info(EncodeUtil.encodeBytes(encrypt.decryptFromBase64(des, "ijielazz", "ijielazz"), ""));

        JSONArray jsonArray = new JSONArray();
        for (int i = 0; i < 10; i++) {
            JSONObject obj = new JSONObject();
            obj.put("userId", 1178);
            obj.put("userName", "张三");
            obj.put("age", 25);
            jsonArray.add(obj);
        }


        log.info(encrypt.encryptStrToBase64(jsonArray.toJSONString(), "ijielazz", "ijielazz"));

        log.info(EncryptEasy.encodeBase64(jsonArray.toJSONString(), "ijielamc"));

        log.info(EncodeUtil.encrypt(jsonArray.toJSONString(), "ijielamc"));
    }
}
